<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>register</title>
<link href="/css/global.css" rel="stylesheet" type="text/css" />
<link href="/css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/js/fun.js"></script>
</head>

<body>
<div class="headLogin">
	<p class="pLogin"></p>
	<script type="text/javascript" src="/js/login.js"></script>
</div>

<div class="header clearfix">
	<div class="logoPic"><img src="/images/pic/logo.gif" width="400" height="121" ></div>
    <div class="ivy555"><img src="/images/pic/555x121.jpg" width="555" height="121"></div>
</div>

<div class="nav">
	<a href="/index.html" >Home</a><a href="/casino.html" class="cur">Casino</a><a href="/promotions.html" >Promotions</a><a href="/players_club.html" >Player Club</a><a href="/entertainment.html" >Entertainment</a><a href="/restaurants_lounges.html" >Restaurants & Lounges</a><a href="/index.php?r=event/showList" >Activity</a>
</div>

<div class="main">
	<div class="mod_a loginCon">
		<div class="th_a"><span class="sMark">Create Your Member Account</span></div>
		<div class="tb_a">
		<form action="/index.php?r=user/register" method="post" onsubmit="return checkSubmit.docheck();return false;">
    	<dl>
			<dt><i>*</i>Must be 19+</dt>
			<dd>
				<input type="radio" name="19+" value="1" checked="checked">YES
				<input type="radio" name="19+" value="0">NO
			</dd>
			<dt><i>*</i>Title</dt>
			<dd>
				<select name="title">
					<option value="1">Mr.</option>
					<option value="2">Mrs.</option>
					<option value="3">Ms.</option>
					<option value="4">Dr.</option>
				</select>
			</dd>
        	<dt><i>*</i>First Name:</dt>
            <dd><input type="text" class="txtInput" name="first_name" rel="first_name" maxlength="50"><span class="sTips">letter and ' is only valid</span></dd>
            <dt><i>*</i>Last Name:</dt>
            <dd><input type="text" class="txtInput" name="last_name" rel="last_name" maxlength="50"><span class="sTips">letter and ' is only valid</span></dd>
            <dt><i>*</i>Password:</dt>
            <dd><input type="password" class="txtInput" name="password" rel="password" maxlength="20"><span class="sTips">letter,number and _ is only valid</span></dd>
			<dt><i>*</i>Confirm PW:</dt>
            <dd><input type="password" class="txtInput" name="confirm_password" rel="confirm_password" maxlength="20"><span class="sTips">letter,number and _ is only valid</span></dd>
            <dt><i>*</i>Email Address:</dt>
            <dd>
				<input type="text" class="txtInput "  name="email1" rel="email" maxlength="80"> @
				<input type="text" class="txtInput txtInputC"  name="email2" rel="email" maxlength="19">
				<input type="hidden"  name="email" maxlength="100">
				<span class="sTips"></span>
			</dd>
			<dt>Home Phone #:</dt>
            <dd>
				<input type="text" class="txtInput txtInputB" name="home_phone1" rel="home_phone" maxlength="3"> —
				<input type="text" class="txtInput txtInputB" name="home_phone2" rel="home_phone" maxlength="7">
				<input type="hidden" name="home_phone">
				<span class="sTips"></span>
			</dd>
			<dt>Cell Phone #:</dt>
            <dd>
				<input type="text" class="txtInput txtInputB" name="cell_phone1" rel="cell_phone" maxlength="3"> —
				<input type="text" class="txtInput txtInputB" name="cell_phone2" rel="cell_phone" maxlength="7">
				<input type="hidden" name="cell_phone">
				<span class="sTips"></span>
			</dd>
			<dt>Mailing Address:</dt>
            <dd><input type="text" class="txtInput txtInputA" name="address" rel="address" maxlength="255"><span class="sTips"></span></dd>
            <dt>Country:</dt>
			<dd>
				<select name="country">
					<option value="1">Canada</option>
					<option value="2">USA</option>
					<option value="3">Others</option>
				</select>
			</dd>
			<dt>Province/State:</dt>
			<dd>
				<select name="province">
					<option value="Newfoundland and Labrador">Newfoundland and Labrador</option>
					<option value="Prince Edward Island">Prince Edward Island</option>
					<option value="Nova Scotia">Nova Scotia</option>
					<option value="New Brunswick">New Brunswick</option>
					<option value="Quebec">Quebec</option>
					<option value="Ontario">Ontario</option>
					<option value="Manitoba">Manitoba</option>
					<option value="Saskatchewan">Saskatchewan</option>
					<option value="Alberta">Alberta</option>
					<option value="British Columbia">British Columbia</option>
					<option value="Yukon">Yukon</option>
					<option value="Northwest Territories">Northwest Territories</option>
					<option value="Nunavut">Nunavut</option>
				</select>
			</dd>
			<dt>Postal Code:</dt>
            <dd><input type="text" class="txtInput" name="postal_code" rel="postal_code" max="5"><span class="sTips"></span></dd>
			<dt>BC Encore Card #:</dt> 
            <dd><input type="text" class="txtInput" name="encorecard" rel="encorecard" max="10"><span class="sTips"></span>Limited time: $10 slot play for new signups. </dd>
			<!--
			<dt>gender:</dt>
            <dd><input type="radio" class="radioInput" name="gender" value="0" checked>&nbsp;<em>male</em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" class="radioInput" name="gender" value="1">&nbsp;<em>female</em><span class="sTips"></span></dd>
            -->
            <dt>&nbsp;</dt>
            <dd><input type="submit" class="submitBtn" value="submit">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" class="reSetBtn" value="reset"></dd>
        </dl>
		</form>
		</div>
    </div>
</div>

<div class="footer">
	<p class="pLogoLinks"><a href="" class="footLogo1"></a><a href="" class="footLogo2"></a><a href="" class="footLogo3"></a><a href="" class="footLogo4"></a><a href="" class="footLogo5"></a><a href="" class="footLogo6"></a><a href="" class="footLogo7"></a><a href="" class="footLogo8"></a><a href="" class="footLogo9"></a><a href="" class="footLogo10"></a><a href="" class="footLogo11"></a><a href="" class="footLogo12"></a><a href="" class="footLogo13"></a><a href="" class="footLogo14"></a><a href="" class="footLogo15"></a></p>
    <p class="footBanner"><img src="/images/pic/footerBanner.gif" width="955" height="52"></p>
    <p class="pTxtLinks"><a href="index.html">Home</a>|<a href="casino.html">Casino</a>|<a href="promotions.html">Promotions</a>|<a href="players_club.html">Players Club</a>|<a href="entertainment.html">Entertainment</a>|<a href="restaurants_lounges.html"> Restaurants &amp; Lounges</a>|<a href="press.html">Press</a>|<a href="careers.html">Careers</a>|<a href="contact.html">Contact</a>|<a href="privacy.html">Privacy Policy</a></p>
    <p class="pCopyRight"><a target="_blank" href="https://mail.starlightcasino.ca">Copyright &copy; Gateway Casinos</a>|<em>All Rights Reserved</em>|<a target="_blank" href="http://bcresponsiblegambling.ca/">Responsible Gaming</a></p>
</div>
<script type="text/javascript">
	var checkSubmit = {
		submit : true,
		docheck : function(){
			if(!this.check_first_name()) return false;
			if(!this.check_password()) return false;
			if(!this.check_confirm_password()) return false;
			if(!this.check_address()) return false;
			if(!this.check_home_phone()) return false;
			if(!this.check_cell_phone()) return false;
			if(!this.check_email()) return false;
			if(!this.check_encorecard()) return false;
			if(!this.check_postal_code()) return false;
			
			if($("input[name='19+']:checked").val() == 0){
				alert('注册用户必须是19岁以上');	
				return false;
			}
			return checkSubmit.submit;
		},
		check_first_name : function(){
			var firstName = $("input[name='first_name']").val();
			var reg = /^[a-zA-Z ']{1,50}$/g;
			if(reg.test(firstName)){
				$("input[name='first_name']").siblings(".sTips").text('');
				checkSubmit.submit = true;
				return true;
			}else{
				$("input[name='first_name']").siblings(".sTips").text('first name is invalid');
				checkSubmit.submit = false;
				return false;
			}
		},
		check_last_name : function(){
			var last_name = $("input[name='last_name']").val();
			var reg = /^[a-zA-Z ']{1,50}$/g;
			if(reg.test(last_name)){
				$("input[name='last_name']").siblings(".sTips").text('');
				checkSubmit.submit = true;
				return true;
			}else{
				$("input[name='last_name']").siblings(".sTips").text('last name is invalid');
				checkSubmit.submit = false;
				return false;
			}
		},
		check_password : function(){
			var password = $("input[name='password']").val();
			var reg = /^\w{1,20}$/g;
			if(reg.test(password)){
				$("input[name='password']").siblings(".sTips").text('');
				checkSubmit.submit = true;
				return true;
			}else{
				$("input[name='password']").siblings(".sTips").text('password is invalid');
				checkSubmit.submit = false;
				return false;
			}
		},
		check_confirm_password : function(){
			var confirm_password = $("input[name='confirm_password']").val();
			if($("input[name='password']").val() != ""){
				if($("input[name='confirm_password']").val() == $("input[name='password']").val()){
					$("input[name='confirm_password']").siblings(".sTips").text('');
					checkSubmit.submit = true;
					return true;
				}else{
					$("input[name='confirm_password']").siblings(".sTips").text('confirm_password must be same with password');
					checkSubmit.submit = false;
					return false;
				}
			}
		},
		check_email : function(){
			var email1 = $("input[name='email1']").val();
			var email2 = $("input[name='email2']").val();
			var reg = /^[0-9a-zA-Z@\._-]{1,100}$/;
			if(reg.test(email1) && reg.test(email2)){
				$("input[name='email']").siblings(".sTips").text('');
				$("input[name='email']").val($("input[name='email1']").val() + '@' + $("input[name='email2']").val());
				checkSubmit.submit = true;
				return true;
			}else{
				$("input[name='email']").siblings(".sTips").text('email is invalid');
				checkSubmit.submit = false;
				return false;
			}
		},
		check_address : function(){
			var address = $("input[name='address']").val();
			var reg = /^.{1,255}$/g;
			if(address != "" && !reg.test(address)){
				$("input[name='address']").siblings(".sTips").text('address is invalid');
				checkSubmit.submit = false;
				return false;
			}
			$("input[name='address']").siblings(".sTips").text('');
			checkSubmit.submit = true;
			return true;
		},
		check_home_phone : function(){
			var phone = $("input[name='home_phone1']").val() + '-' + $("input[name='home_phone2']").val();
			var reg = /^\d{3}-\d{7}$/g;
			if(phone != "" && !reg.test(phone)){
				$("input[name='home_phone']").siblings(".sTips").text('home phone is invalid');
				checkSubmit.submit = false;
				return false;
			}
			$("input[name='home_phone']").siblings(".sTips").text('');
			$("input[name='home_phone']").val(phone);
			checkSubmit.submit = true;
			return true;
		},
		check_cell_phone : function(){
			var phone = $("input[name='cell_phone1']").val() + '-' + $("input[name='cell_phone2']").val();
			var reg = /^\d{3}-\d{7}$/g;
			if(phone != "" && !reg.test(phone)){
				$("input[name='cell_phone']").siblings(".sTips").text('cell phone is invalid');
				checkSubmit.submit = false;
				return false;
			}
			$("input[name='cell_phone']").siblings(".sTips").text('');
			$("input[name='cell_phone']").val(phone);
			checkSubmit.submit = true;
			return true;
		},
		check_encorecard : function(){
			var encorecard = $("input[name='encorecard']").val();
			var reg = /^\d{1,10}$/;
			if(encorecard != "" && !reg.test(encorecard)){
				$("input[name='encorecard']").siblings(".sTips").text('encorecard is invalid');
				checkSubmit.submit = false;
				return false;
			}
			$("input[name='encorecard']").siblings(".sTips").text('');
			checkSubmit.submit = true;
			return true;
		},
		check_postal_code : function(){
			var postal_code = $("input[name='postal_code']").val();
			var reg = /^\d{5}$/;
			if(postal_code != "" && !reg.test(postal_code)){
				$("input[name='postal_code']").siblings(".sTips").text('postal code is invalid');
				checkSubmit.submit = false;
				return false;
			}
			$("input[name='postal_code']").siblings(".sTips").text('');
			checkSubmit.submit = true;
			return true;
		}
	};
	
	$(document).ready(function(){
		$(".loginCon .txtInput").each(function(){
			$(this).blur(function(){
				var name = $(this).attr("rel");
				eval("if(checkSubmit.hasOwnProperty('check_" + name +"')){checkSubmit.check_" + name + "()}");
			});
		});
		$("select[name='country']").change(function(){
			var country = $(this).val();
			if(country == 1 || country == 2){
				$.ajax({
					type : "post",
					url : "/index.php?r=user/showProvince",
					data : {country : country},
					dataType : "json",
					success : function(data){
						$("select[name='province']").find("option").remove();
						for(var i=0; i<data.length; i++){
							$("select[name='province']").append('<option value="'+data[i]+'">'+data[i]+'</option>');
						}
					}
				});
			}
		});
	});
</script>
</body>
</html>
